home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group99a.txt / 000098_icon-group-sender _Fri Apr 9 17:25:30 1999.msg < prev    next >
Internet Message Format  |  2000-09-20  |  1KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id RAA02117
  4.     for icon-group-addresses; Fri, 9 Apr 1999 17:24:46 -0700 (MST)
  5. Message-Id: <199904100024.RAA02117@baskerville.CS.Arizona.EDU>
  6. Date: Fri, 9 Apr 1999 15:06:18 -0700 (PDT)
  7. From: Shamim Mohamed <spm@drones.com>
  8. To: icon-group@optima.CS.Arizona.EDU
  9. Subject: 99 Bottles of Beer on the Wall
  10. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  11. Status: RO
  12.  
  13. A friend pointed me to a site featuring programs to print out the "99
  14. bottles of beer on the wall" song. I thought the Icon version lacked a
  15. certain je ne sais quois; this is the best I could come up with:
  16.  
  17. # Look ma, no loops!
  18.  
  19. procedure main(a)
  20.    write(stanza(beer(n := a[1]))) & n = 0
  21. end
  22.  
  23. procedure beer(n)
  24.    n >= 0 | fail
  25.    suspend n || " bottle" || (if n ~= 1 then "s" else "") || " of beer" |
  26.       beer(n-1)
  27. end
  28.  
  29. procedure stanza(s)
  30.    s[1] ~== "0" | return s || "."
  31.    return s || " on the wall.\n\n" || s || " on the wall.\n" || s ||
  32.      ".\nTake one down, pass it around,"
  33. end
  34.  
  35.  
  36. I'm not happy with the way plurals are handled. Anyone else?
  37.  
  38. -s
  39.